package LECONGHAU.OOP.EXCERCISE01.BAI4;

import java.util.Scanner;

public class MODELS {
	String thang, nam;
	public void nhap(){
		do {
			System.out.println("nhap vao thang can tinh so ngay");
			Scanner sc = new Scanner(System.in);
			thang = sc.nextLine();
			System.out.println("nhap vao nam");
			nam = sc.nextLine();
			if (thang.isEmpty() || Integer.parseInt(thang) < 1
					|| Integer.parseInt(thang) > 12) {
				System.out.println("vui long nhap lai");
			}
		} while (thang.isEmpty() || Integer.parseInt(thang) < 1
				|| Integer.parseInt(thang) > 12);
	}
	public int Date(){
		int kq;
		int intthang = Integer.parseInt(thang);
		int intnam = Integer.parseInt(nam);
		if (intthang == 4 || intthang == 6 || intthang == 9 || intthang == 11) {
		kq=	30;
		} else if (intthang == 2) {
			if (intnam % 4 == 0 && intnam % 100 == 0 || intnam % 400 == 0) {
				kq=29;
			} else {
				kq=28;
			}
		} else {
		kq=31;
		}
		return kq;
	}
}
